import {NavBar} from "antd-mobile";
import {useNavigate} from "react-router-dom";
import React, {CSSProperties} from "react";

interface Props {
    title?: string,
    back?:null|'',
}

const eleStyle:CSSProperties = {
    position: "fixed",
    left: 0,
    top: 0,
    background:"#1677ff",
    width:"100vw",
    color:"#fff",
    zIndex:999
}

const Header = React.memo(({title = "详情",back=''}: Props) => {
    const n = useNavigate();
    return (
        <div style={eleStyle}>
            <NavBar back={back} onBack={() => n(-1)}>{title}</NavBar>
        </div>
    )
})

export default Header;